/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.hpi.generationmanager.tesma.data;

import de.hpi.generator.model.Column;
import de.hpi.generator.model.ColumnsCollection;
import de.hpi.generator.model.Table;
import de.hpi.generator.model.TesmaColumn;
import java.util.ArrayList;

/**
 *
 * @author Michael
 */
public class TesmaColumnsCollection extends ColumnsCollection {

    public TesmaColumnsCollection(Table aOwner) {
        super(aOwner);
    }

    void distributeData(ArrayList<Integer> aRowCells) throws Exception {
        int aRowCellIndex = 0;
        for (Column tesmaColumn : this) {
            ((TesmaColumn) tesmaColumn).registerValue(aRowCells.get(aRowCellIndex));
            aRowCellIndex++;
        }
    }

    void clean() throws Exception {
        if (isOpen()) {
            throw new Exception("Columns is open. Clean was cancelled");
        }
        
        for (Column tesmaColumn : this) {
            tesmaColumn.clean();
        }
    }
}
